﻿using InvoiceInvoker.Logic.Repositories;
using NUnit.Framework;
using System.Collections.Generic;

namespace InvoiceInvoker.Logic.Tests.RepositoriesTests
{
	[TestFixture]
	public class InvoicePatternRepositoryTests
	{
		InvoicePatternRepository repository;

		[SetUp]
		public void TestsSetup()
		{
			repository = new InvoicePatternRepository(1);
		}

		[Test]
		public void Adds()
		{
			InvoicePattern pattern = new InvoicePattern();
			pattern.RegisteredSellerId = 1;
			pattern.PaymentCurrency = "Currency";
			pattern.PaymentType = "Type";
			pattern.Remarks = "Remarks";

			RegisteredProduct product1 = new RegisteredProduct();
			RegisteredProduct product2 = new RegisteredProduct();
			RegisteredProduct product3 = new RegisteredProduct();
			product1.Name = "testProduct1";
			product2.Name = "notImportant";
			product3.Name = "testProduct3";

			List<RegisteredProduct> products = new List<RegisteredProduct>();
			products.Add(product1);
			products.Add(product2);
			products.Add(product3);

			repository.Add(pattern, products);
		}

		[Test]
		public void GetsByProduct()
		{
			List<InvoicePattern> result = repository.GetByProduct("gets");
			Assert.AreEqual(3, result.Count);
		}
	}
}
